﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="pages_PersonnelOffice_WorkingReport_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
  <title>GridView和下拉菜单DropDownList结合</title>
  <script language="javascript">
function DoCal()
{
  var e = event.srcElement;
  var row = e.parentNode.parentNode;
  var txts = row.all.tags("INPUT");
  if (!txts.length || txts.length < 3)
     return; 
  var q = txts[txts.length-3].value;
  var p = txts[txts.length-2].value;
  if (isNaN(q) || isNaN(p))
     return;
  q = parseInt(q);
  p = parseFloat(p);
  txts[txts.length-1].value = (q * p).toFixed(2);
}
</script>

</head>
<body>
  <form id="form1" runat="server">
  
      <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                        CellPadding="3" Font-Size="9pt"  BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" OnRowEditing="GridView1_RowEditing" OnRowCancelingEdit="GridView1_RowCancelingEdit1">
                  
                        
                        <FooterStyle BackColor="White" ForeColor="#000066" />
                        <Columns>
                           <asp:TemplateField HeaderText="数量">
 <ItemTemplate>
  <asp:TextBox id="ShuLiang" runat='server' Text='<%# DataBinder.Eval(Container.DataItem,"dms_emp_base_id")%>'
        onkeyup="javascrip:DoCal()"/>
  <asp:RegularExpressionValidator id="revS" runat="server"
           ControlToValidate="ShuLiang" ErrorMessage="must be integer" ValidationExpression="^\d+$" />
</ItemTemplate>
</asp:TemplateField>
 <asp:BoundField DataField="dms_emp_base_id" HeaderText="单价" />   
 <asp:BoundField DataField="dms_emp_base_id" HeaderText="金额" />    

                                
                        </Columns>
                        <RowStyle ForeColor="#000066" />
                        <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                        <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                    </asp:GridView>
                    <br/>
                    
<asp:GridView ID="GridView2" runat="server" BackColor="White" BorderColor="#CC9966"
            BorderStyle="None" BorderWidth="1px" CellPadding="4" AutoGenerateColumns="False" Width="440px">
<Columns>

</Columns>
</asp:gridview>


  </form>
</body>
</html>
